//  https://www.luogu.com.cn/problem/P1098

#include<iostream>
#include<algorithm>
using namespace std;

int p1, p2, p3;
string s, ret;
bool isdig(char ch)
{
	return ch >= '0' && ch <= '9';
}
bool islet(char ch)
{
	return ch >= 'a' && ch <= 'z';
}
void add(char left, char right)
{
	string t;
	for (char ch = left + 1;ch < right;ch++)
	{
		char tmp = ch;
		if (p1 == 2 && islet(tmp)) tmp -= 32;
		else if (p1 == 3) tmp = '*';

		for (int i = 0;i < p2;i++)
		{
			t += tmp;
		}
	}
	if (p3 == 2)
		reverse(t.begin(), t.end());

	ret += t;
}
int main()
{
	cin >> p1 >> p2 >> p3 >> s;
	for (int i = 0;i < s.size();i++)
	{
		char ch = s[i];

		if (ch != '-' || i == 0 || i == s.size() - 1)
			ret += ch;
		else
		{
			char left = s[i - 1], right = s[i + 1];
			if (isdig(left) && isdig(right) && left < right
				|| islet(left) && islet(right) && left < right)
			{
				add(left, right);
			}
			else
				ret += ch;
		}
	}

	cout << ret << endl;

	return 0;
}